public class demo39 {
    //容积最大的水桶  x和y轴
    class Solution {
        public int maxArea(int[] height) {
            if(height == null) return 0;
            if(height.length == 2) return height[0]<height[1]? height[0]:height[1];
            int i = 0,j = height.length-1,area = 0;
            while(i<j)
            {
                area = height[i]<height[j]? Math.max(area,(j-i)*height[i++]) : Math.max(area,(j-i)*height[j--]);

            }
            return area;
        }
    }
}
